package com.zzty.common;
import org.apache.commons.mail.HtmlEmail;
public class MailSender {
    public static void main(String[] args) throws Exception {
        String body="test email";
        System.out.println("send email begin");
        HtmlEmail email = new HtmlEmail();

        email.setHostName("smtp.163.com"); // 设定smtp服务器
        email.setAuthentication("wenteng_cui@163.com", "teng1234"); // 设定smtp服务器的认证资料信息
        email.addTo("zzty_dendi@163.com", "AAAA"); // 设定收件人
        email.setFrom("wenteng_cui@163.com", "自在天原");
        email.setSubject("nihao");
        email.setCharset("UTF-8");
        email.setHtmlMsg("<html><h1>"+body+"</h1></html>");
        email.send();
        System.out.println("end");
    }
}
